﻿using System.Collections.Generic;
using System.Linq;

namespace Sidvall.WorkItemManager.UI.Entities
{
    public partial class WebTarget
    {
        #region Public Members

        #region WebResult

        private WebResult _WebResult;
        public WebResult WebResult
        {
            get
            {
                return _WebResult;
            }
            set
            {
                _WebResult = value;
                OnPropertyChanged(nameof(WebResult), true, false);
            }
        }

        #endregion

        #region LoadWebResult

        public void LoadWebResult(IEnumerable<WebResult> items)
        {
            if (items == null)
                return;
            this.WebResult = (from o in items
                              where o.WebAddress.Equals(this.WebAddress, System.StringComparison.OrdinalIgnoreCase)
                              select o).FirstOrDefault();
        }

        #endregion

        #endregion
    }
}